package com.ushio.authservice.department.controller;

import com.ushio.authservice.department.entity.vo.DepartmentVo;
import com.ushio.authservice.department.service.DepartmentService;
import com.ushio.commonmodule.pojo.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 19451
 */
@RestController
@RequestMapping("/department")
@Tag(name = "Department API", description = "部门管理")
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;

    @GetMapping
    @Operation(summary="获取所有部门",description = "获取所有部门")
    private Result getDepartmentAll(){

        try{
            List<DepartmentVo> departmentAll = departmentService.getDepartmentAll();
            return Result.success(departmentAll);

        }catch (Exception e){

            e.printStackTrace();

            return Result.fail(e.getMessage());

        }


    }

}
